import { useDrag } from "react-dnd";
import styles from "../index.less";

const DragTableSheet = () => {
    const [{ isDragging, canDrag }, drag] = useDrag(() => ({
        type: 'TABLE_SHEET',
        item: { type: 'TABLE_SHEET', name: '明细表' },
        collect: (monitor) => ({
            isDragging: monitor.isDragging(),
            canDrag: monitor.canDrag(),
        }),
        options: {
            /* 高级配置 */
        },
    }));

    return (
        <div
            ref={drag} // 绑定拖拽功能
            className={styles.dragItem}
            style={{
                opacity: isDragging ? 0.5 : 1,
            }}
        >
            明细表
        </div>
    );
};

export default DragTableSheet;